home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group93b.txt
/
000074_icon-group-sender _Mon May 10 07:41:56 1993.msg
< prev
next >
Wrap
Internet Message Format
|
1993-06-16
|
6KB
Received: by cheltenham.cs.arizona.edu; Mon, 10 May 1993 07:39:56 MST
Date: 10 May 1993 07:41:56 -0600 (CST)
From: Chris Tenaglia - 257-8765 <TENAGLIA@mis.mcw.edu>
Subject: Icon Tips
To: icon-group@cs.arizona.edu
Message-Id: <01GY03I039EA8WW3GW@mis.mcw.edu>
Organization: Medical College of Wisconsin (Milwaukee, WI)
X-Vms-To: IN%"icon-group@cs.arizona.edu"
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
Content-Transfer-Encoding: 7BIT
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
From: IN%"MAILER-DAEMON@watserv1.uwaterloo.ca" "Mail Delivery Subsystem" 9-MAY-1993 00:06:16.42
To: IN%"walter!xenitec!spectre.uunet.ca!mis.mcw.edu!tenaglia@watserv1.uwaterloo.ca"
Subj: Returned mail: Service unavailable
> I'm going to give my organization a one-hour talk on Icon, with an
> emphasis on using Icon to build prototypes quickly. Does anyone have
> any suggestions (or religious beliefs) about what should be included
> in such a talk? Does anyone have a favorite code fragment? My
> audience is composed of researchers who are proficient Unix hackers,
> so I don't have to pull any punches :-)
> Norman Ramsey
> norman@bellcore.com
I like Richard Goerwitz points about the novelty of the language and how
it pushes programming paradigms. I also think speed of development and
prototyping are another super point. I gave a 1 hour talk on it at a DECUS
symposium in Las Vegas in December. I'm not accustomed to speaking so I
think I was rather boring, but the crowd was interested, and that helped.
The only questions I got afterword were 'how do I get this for my system?'.
I think my overheads were pretty good. I brought 20 paper copies of them,
and they nearly all disappeared at the Languages and Tools campground.
Good luck on your endeavor.
Here are my favorite fragments :
I call | the either-or operator. One use might be like:
(out := open("OUT.DAT","a") | #either open for append
(out := open("OUT.DAT","w") | #or for write/create
stop("Can't write to OUT") #or flag the error
I call &random "amper-random" and other variables that begin with &, amper
variables. This helps when speaking about the language without visual aids.
The icon project hasn't said to much about this idea, but I use it, maybe
because the FOCUS language also used around here has amper variables too,
so it's a little more familiar.
#
# parse a string into a list with respect to a delimiter
#
procedure parse(line,delims) # 1p
static chars
chars := &cset -- delims
tokens := []
line ? while tab(upto(chars)) do put(tokens,tab(many(chars)))
return tokens
end
#
# prompt for an input string
#
procedure input(prompt) # 2p
writes(prompt)
return read()
end
#
# converts a linear list into columnated format (like unix ls)
#
procedure cook(lst,cols,width) # 3p
local limit,size,array,meal,food,i,j,row,column
/cols := 5 ; /width := 80
items := *lst ; size := width / cols
rows := items / cols + 1 ; limit := rows * cols
array := table(" ") ; meal := []
until *lst > limit do put(lst," ") # push for reverse order
every column := 1 to cols do
every row := 1 to rows do
array[row||","||column] := pop(lst) # pull for reverse order
every row := 1 to rows do
{
food := ""
every column := 1 to cols do
food ||:= left(array[row||","||column],size)
put(meal,trim(food))
}
return meal
end
#
# ebcdic/ascii mapping string
#
ebcdic := "\000\001\002\003\234\011\206\177\227\215\216\013\014\015\016\017"||
"\020\021\022\023\235\205\010\207\030\031\222\217\034\035\036\037"||
"\200\201\202\203\204\012\027\033\210\211\212\213\214\005\006\007"||
"\220\221\026\223\224\225\226\004\230\231\232\233\024\025\236\032"||
"\040\240\241\242\243\244\245\246\247\250\133\056\074\050\053\041"||
"\046\251\252\253\254\255\256\257\260\261\135\044\052\051\073\136"||
"\055\057\262\263\264\265\266\267\270\271\174\054\045\137\076\077"||
"\272\273\274\275\276\277\300\301\302\140\072\043\100\047\075\042"||
"\303\141\142\143\144\145\146\147\150\151\304\305\306\307\310\311"||
"\312\152\153\154\155\156\157\160\161\162\313\314\315\316\317\320"||
"\321\176\163\164\165\166\167\170\171\172\322\323\324\325\326\327"||
"\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347"||
"\173\101\102\103\104\105\106\107\110\111\350\351\352\353\354\355"||
"\175\112\113\114\115\116\117\120\121\122\356\357\360\361\362\363"||
"\134\237\123\124\125\126\127\130\131\132\364\365\366\367\370\371"||
"\060\061\062\063\064\065\066\067\070\071\372\373\374\375\376\377"
#
# formats a input string into an output string using a control string
# patch("120389","##/##/19##") returns 12/03/1989
# patch("12/03/1989","##$") returns 12
#
procedure edit(var,mask) # 9p uses string scanning
text := ""
var ? {
every chr := !mask do {
case chr of {
"#" : text ||:= move(1)
"$" : move(1)
default : text ||:= chr
}
}
}
return text
end
#
# THIS ROUTINE SETS THE CURSOR TO A GIVEN X (COL) Y(ROW) SCREEN LOCATION
#
procedure at(x,y) # 11p
return "\e[" || y || ";" || x || "f"
end
# #
# FILE : PROGRAM.ICN
# DESC : GENERIC PROGRAM STARTER
#
# UPDATE BY WHAT
#
#
procedure main(param)
source := param[1] | input("_Source:")
target := param[2] | input("_Target:")
(in := open(source)) | stop("Can't open ",source)
(out := open(target,"w")) | stop("Can't open ",target)
while line := read(in) do
{
}
close(in) ; close(out)
end
Chris Tenaglia (System Manager) | "The past explained,
Medical College of Wisconsin | the future fortold,
8701 W. Watertown Plank Rd. | the present largely appologized for."
Milwaukee, WI 53226 | Organon to The Doctor
(414)257-8765 |
tenaglia@mis.mcw.edu